#ifndef BOOST_H
#define BOOST_H

#include <stdint.h>
#include <stdbool.h>
typedef void (*load_a)(void);

#define BOOT_VERSION "1.0.1"

// bootloader地址相关设置
#define FLASH_SADDR 0x08000000
#define STM32_PAGE_NUM 64
#define STM32_PAGE_SIZE FLASH_PAGE_SIZE
#define STM32_B_PAGE_NUM 13 // Bootloader所占扇区数
#define PRIVATE_PAGE_NUM 1  // 私人变量所占扇区数
#define STM32_A_PAGE_NUM (STM32_PAGE_NUM - STM32_B_PAGE_NUM - PRIVATE_PAGE_NUM)

#define STM32_PRI_START_ADDR (FLASH_SADDR + STM32_B_PAGE_NUM * STM32_PAGE_SIZE)                    // 私人变量起始地址
#define STM32_A_START_ADDR (FLASH_SADDR + (STM32_B_PAGE_NUM + PRIVATE_PAGE_NUM) * STM32_PAGE_SIZE) // A区起始地址

void JumpToApp(void);
void BootLoader_Brance(void);
void LOAD_APP(uint32_t addr);
void Boot_clean(void);
__STATIC_INLINE void MSR_SP(uint32_t BootAddr);
#endif